﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using G.Reader.Data;
using Microsoft.Phone.Controls;

namespace G.Reader
{
    public class ReaderApplicationService : IApplicationService
    {

        public void StartService(ApplicationServiceContext context)
        {

            #region 添加有Tile效果的类型
            TiltEffect.TiltableItems.Add(typeof(G.Controls.TileControl));
            TiltEffect.TiltableItems.Add(typeof(ListBoxItem));
            TiltEffect.TiltableItems.Add(typeof(System.Windows.Controls.Primitives.ButtonBase));
            #endregion

            #region 本地数据库
            //
            using (BookDataBase db = BookDataBase.Create())
            {
                if (!db.DatabaseExists())
                {
                    db.CreateDatabase();
                }
            }

            using (MessageDatabase db = MessageDatabase.Create())
            {
                if (!db.DatabaseExists())
                {
                    db.CreateDatabase();
                }
            }
            #endregion
        }

        public void StopService()
        {
            
        }
    }
}
